package com.fling.services;

import com.fling.Constants;
import com.fling.Locator;
import com.fling.entity.Entity;
import com.fling.observer.Event;
import com.fling.observer.Observer;


public class Achievements implements Observer, Constants {

	private boolean hoarder=false;
	private boolean bigClimber=false;
	private boolean averageClimber=false;
	private boolean smallClimber=false;
	private boolean hardcore=false;

	public Achievements() {

	}

	@Override
	public void onNotify(Entity entity, Event event) {
		switch (event) {
		case EVENT_RESTART:
			if(!smallClimber && Locator.getTopDistance() > 10){
				unlock(ACHV_SMALL_CLIMBER);
				smallClimber=true;
			}
			if(!averageClimber && Locator.getTopDistance() > 50){
				unlock(ACHV_AVERAGE_CLIMBER);
				averageClimber=true;
			}
			if(!bigClimber && Locator.getTopDistance() > 100){
				unlock(ACHV_BIG_CLIMBER);
				bigClimber=true;
			}
			if(!hoarder && Locator.getCoins() > 100){
				unlock(ACHV_HOARDER);
				hoarder=true;
			}
			break;
		case EVENT_HARD_MODE:
			if(!hardcore){
				unlock(ACHV_HARDCORE);
				hardcore=true;
			}
		default:
			break;
		}

	}
	
	public void unlock(String id){
		Locator.getDevice().unlockAchievements(id);
	}

	public boolean isHoarder() {
		return hoarder;
	}

	public void setHoarder(boolean hoarder) {
		this.hoarder = hoarder;
	}

	public boolean isBigClimber() {
		return bigClimber;
	}

	public void setBigClimber(boolean bigClimber) {
		this.bigClimber = bigClimber;
	}

	public boolean isAverageClimber() {
		return averageClimber;
	}

	public void setAverageClimber(boolean averageClimber) {
		this.averageClimber = averageClimber;
	}

	public boolean isSmallClimber() {
		return smallClimber;
	}

	public void setSmallClimber(boolean smallClimber) {
		this.smallClimber = smallClimber;
	}

	public boolean isHardcore() {
		return hardcore;
	}

	public void setHardcore(boolean hardcore) {
		this.hardcore = hardcore;
	}
	
	

}
